<template>
	<view class="popup">
		<u-popup :show="show" mode="center" width="516" round="20" @close="close">
			<view class="get-main">
				<!-- 				<u-image class="get-image" :src="currentContent.icon" width="348rpx" height="276rpx" radius="0">
					<template v-slot:loading>
						<u-loading-icon></u-loading-icon>
					</template>
				</u-image> -->
				<view class="title">{{currentContent.title}}</view>
				<view class="content-text">{{currentContent.text}}</view>
				<button class="btn-confirm" type='primary' @click="confirm">{{currentContent.setText}}</button>
				<view class="btn-close" @click="close">{{currentContent.cancelText}}</view>
			</view>
		</u-popup>
	</view>
</template>
<script>
	export default {
		name: "m-not-get",
		data() {
			return {
				show: false,
				type: 1,
				content: [{
					title: "您尚未实名认证",
					text: "当前操作需要实名认证，是否继续？",
					icon: "../../static/icon/smrz.png",
					setText: '前往认证',
					cancelText: '以后再说'
				}, {
					title: "您尚未企业认证",
					text: "当前操作需要企业认证，是否继续？",
					icon: "../../static/icon/qyrz.png",
					setText: '前往认证',
					cancelText: '以后再说'
				}, {
					title: "您尚未设置支付密码",
					text: "是否前往设置支付密码，是否继续？",
					icon: "../../static/icon/qyrz.png",
					setText: '前往认证',
					cancelText: '以后再说'
				}],
				currentContent: {
					title: "",
					text: "",
					icon: "",
					setText: '',
					cancelText: ''
				}
			};
		},
		props: { // 此处定义传入的参数
		},
		watch: {},
		mounted() {

		},
		methods: {
			open(type) {
				this.type = type;
				this.show = true;
				if (this.type == 2) { // 用户企业认证
					this.currentContent = this.content[1]
				} else if (this.type == 3) { // 用户实名认证	
					this.currentContent = this.content[0]
				} else if (this.type == 4) { // 用户实名认证	
					this.currentContent = this.content[2]
				}
			},
			// 跳转
			confirm() {
				// 获取用户信息
				let userInfo = this.$getUserInfo();
				// 调用父级重置选择方法
				if (this.type == 2) { // 用户企业认证
					if (userInfo.is_enterprise_auth == 0) {
						this.$navigateTo('/subPackages/userAuth/enterprise-auth')
					} else {
						this.$navigateTo('/subPackages/userAuth/examine?type=1')
					}
				} else if (this.type == 3) { // 用户实名认证
					if (userInfo.is_real_auth == 0) {
						this.$navigateTo('/subPackages/userAuth/real-name-auth')
					} else {
						this.$navigateTo('/subPackages/userAuth/examine?type=2')
					}
				} else if (this.type == 4) { // 设置支付密码
					this.$navigateTo('/subPackages/userInfo/payPassword')
				}
				this.close()
			},
			close() {
				this.show = false;
			},
		},
	}
</script>
<style lang="scss">
	.get-main {
		width: 600rpx;
		padding: 50rpx 0 30rpx;
		font-size: 28rpx;
		text-align: center;

		.get-image {
			width: 348rpx;
			height: 276rpx;
			margin: 30rpx auto;
		}

		.title {
			font-weight: 600;
		}

		.content-text {
			color: #bdbdbf;
			font-weight: 600;
			margin-top: 20rpx;
		}

		.btn-confirm {
			width: 75%;
			background-image: linear-gradient(90deg, #f5602f, #FF2D71);
			color: #ffffff;
			margin: 0 auto;
			height: 75rpx;
			line-height: 75rpx;
			border: none;
			font-size: 28rpx;
			border-radius: 50rpx;
			margin-top: 50rpx;
		}

		.btn-close {
			margin-top: 30rpx;
			color: rgba(0, 0, 0, .6);
		}
	}
</style>